Skip to content

fix(limrun): scope iOS runner tools to lease operations - #4720

Closed
thymikee wants to merge 36 commits into
0.22from
refactor/0.22-limrun-provider-host
Closed

thymikee wants to merge 36 commits into
0.22from
refactor/0.22-limrun-provider-host

Conversation

@thymikee

@thymikee thymikee commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Restrict Limrun’s iOS runner to opening targets and applying or clearing runtime hints. The Apple runtime rejects Android hint targets. The built-in Limrun runtime uses its existing lease-scoped operations. This updates 10 files for #3311.

Validation

  • Base 92f96af0b5, tested head 81136d5df3d663ddb11d38cccc7dfc77098e4536.
  • pnpm check:affected --run --head 81136d5df3 passed at the exact commit with an unchanged checkout (42 passed, 25 skipped, receipt run-tmd3C4).
  • Focused coverage verifies the runner authority boundary and the Apple-only hint route. Hosted checks, review, and packed registry-to-daemon live evidence for Limrun iOS and Android are pending.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

airowe and others added 30 commits November 16, 2026 19:23
…#4177)

* fix(daemon): refuse leased requests that name no session at admission

The CLI already requires an explicit session on a leased remote
connection, but a direct RPC or socket caller could still omit it and
land in the shared default session.

HTTP and socket intake now mark a missing or blank session on the
daemon-only request envelope. Admission refuses a marked request that
allocates a provider lease or carries a lease, with the existing
REMOTE_SESSION_REQUIRED reason, before anything is allocated or
dispatched. A provider named without a lease stays allowed, and an
explicit session name, including "default", counts as named.

Closes #4171

* fix(daemon): close the remaining unnamed lease paths at admission

agent_device.install_from_source did not record an omitted session, so an
unnamed install could reach the provider lease held by the default session.
A batch step also lost the marker, so a step carrying lease flags passed
admission.

Lease-exempt commands such as session_list now read only a lease they carry
themselves, so an unnamed inventory command still answers while the default
session holds a provider lease.

The refusal also names the session parameter for direct RPC callers, and the
ledger now digests the shared session helper and describes blank names for
released clients correctly.

* fix(daemon): keep session-held leases out of unnamed artifacts and queued requests

Only inventory and lease-lifecycle commands now ignore the lease on the
session they resolve. artifacts and events act through that session, so an
unnamed request for them is refused again.

Admission also repeats the check under the session lock, because an unnamed
request can wait behind an open that leaves a provider lease on the session.

* fix(daemon): refuse unnamed doctor and capabilities on a leased session

Both resolve the session's device, so an unnamed request could inspect a
device another caller leased. An explicit list now names the commands that
never read the session, and every other command stays refused.
release_materialized_paths joins that list, because it uses no session.

* fix(daemon): treat a blank session as the default one at intake

A blank session name was marked as unnamed but stayed its own session, so the marker
described a request that still ran somewhere else. HTTP and socket intake now both
resolve a missing or blank name to the default session. A mutation case holds the
marker in place, and the transport tests assert that the handler ran on that session.

* fix(daemon): refuse the Node client on a provider lease when it names no session

The Node client always sends the literal default session and reports the omission in
meta.sessionExplicit, so intake never marked it and an unnamed leases.allocate still
allocated a lease. One intake helper now decides this for the socket and every HTTP
builder, and lease RPC params carry the fact. The commands that ignore their session's
lease become a registry trait. Docs examples and in-repo clients on a provider lease
now name a session.

* fix(contracts): forward a session named in flags on the lease RPC

The lease RPC projection dropped flags.session and forwarded sessionExplicit false, so
a caller that named its session in flags was refused there but not on the command
method. The route now forwards the shared predicate's answer. Also cover the lease
method in the real-daemon test and document where each method reads the fact.

* refactor(kernel): home the session-naming predicate in the record module

The lease RPC builder needs the predicate, and importing it from the contracts hub made three entry surfaces evaluate more modules. The record module is already in those closures.

* docs(daemon): say batch steps also carry the session-omitted marker

* fix(daemon): keep a blank session literal at intake

Intake rewrote a blank session to default, so after main made each web
session its own device, an HTTP RPC open with session "" ran the default
browser instead of being refused with web_session_name_invalid. A missing
session still runs under default. A blank one keeps its literal and still
names no session, so a provider lease refuses it as before and the web
name check refuses it too.

Refs #4171

* fix(daemon): import the session naming check from kernel/record

Main's router now reports a named session that is missing, through
namesSessionExplicitly from kernel/contracts. This branch moved that
helper to kernel/record, so the merge left a dangling import.

Refs #4171

* chore(gates): reconcile admission checks with 0.22 owners

---------

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
…) (#4504)

* refactor(plugins): remove the version 1 provider plugin contract (#3759)

Drop the v1 loader adapter, the manifest-driven discovery and store branches, the
manifest credential and connection fallbacks, and the install-time provider
collision checks. A store package is discovered through its exports only, and
everything it declares comes from the object its factory returns. The registry
settles a duplicate provider id by first claim.

Remove the v1 entries and manifest declarations from TestMu AI and Revyl, and
document the migration to an AgentDevicePluginFactory in ./agent-device.

* refactor(plugins): keep entry resolution module-private after the v1 removal

discoverPluginEntry is the only caller of resolvePluginEntry, and the store's
version-selector check lost its second caller with the manifest branches, so
both become module-local. Drop the deleted v1 entries from the Fallow entry
list. Removes the dead-export findings the fallow audit raised at head.

* refactor(plugins): answer the review findings on the v1 removal

Point the traversal fixture at the file that exists outside the package, say the
entry contract as it is (root export, which is main without exports), move the
v1 manifest's connection to connection.capabilities in the migration note and
separate the incompatible_plugin and invalid_plugin cases, claim the built-in id
with a non-routing provider in the store test, and state what install checks.
* refactor(sdk): require explicit host dependencies in 0.22

* chore(gates): remove ambient SDK process entry waivers

* fix(sdk): preserve request overlays and archive working directories
#4528)

* test(maestro): colocate engine export tests before extraction

* test(cli): isolate Maestro suite forwarding from network reporting

* test(cli): restore isolated cwd for Maestro suite forwarding
…4555)

* chore(gates): keep the private Maestro preparation atomic

Prepare the private factory, declaration chunks and artifact checks together with matching export, dependency and project-reference contracts. Keep the built-in consumer behavior until the migration layer. Omit the unused unshipped ManagedPlugin alias.

* chore(gates): cover lazy Maestro factory resource ownership

* chore(gates): assert the retained diagnostic callback before invocation

* chore(gates): preserve host clickability across the Maestro bundle boundary

* chore(gates): preserve host screen-origin refusal across Maestro bundles

* chore(gates): preserve package check argument forwarding

* chore(gates): align package guard with forwarded arguments

* fix(maestro): address preparation review invariants

* chore(maestro): declare package license and repository

* fix(gates): retain Maestro conformance source ownership

* chore(gates): retain unit coverage for Maestro conformance inputs

* fix(build): preserve Node 22.13 development packaging

* chore(gates): verify development packaging on Node 22.13
* chore(gates): keep the managed Maestro migration atomic

Land the consumer migration, isolated test installation and resolver setup, artifact retirement, dependency removal and matching enforcement as one self-contained layer. Preserve the existing plugin spine rank instead of lowering its boundary.

* fix(replay): load only the selected client backend package
…4534)

Move execution-neutral replay data and shared ports with matching package exports, dependency declarations and contract pins. Preserve the previously reviewed layer content.
…ry (#4535)

* chore(gates): preserve native registry identity and recoverable lazy loads

* docs(plugins): distinguish native and format setup factories

* docs(plugins): name the native execution object precisely
…4537)

* chore(gates): keep optional replay routing and plugin admission atomic

Land the native plugin with its routing consumer, installation, workflows and package guards. Retain C3 rejected-load retry and inventory ownership with typed repair guidance; preserve lower-layer slot identity and refuse raw YAML suites before plugin or device admission.

* fix(mcp): avoid duplicate native replay search keyword
* test(connect): move BrowserStack connect cases into a provider-owned test file

Give the BrowserStack connect cases their own file beside cloud-connect-testmu.test.ts, split from the cloud-profile and profile-field tests. Behavior and assertions stay the same, so the BrowserStack provider extraction can change one provider-owned file instead of the shared connect tests.

* test(connect): remove orphaned adapter import after suite isolation

* test(browserstack): fix connect suite ownership and unused import
Remove the internal preview channel special case from CLI updates. Preserve the generic latest fallback and existing main-nightly behavior.

Exact-head affected validation passed at 716dddd: 42 passed, 25 skipped; hosted checks: 13 successful, 1 skipped. No release or package publication.
Library clients attach to an existing daemon, including replay and test calls. Remove managed startup, replacement and timeout retirement; retain explicit ensureDaemon, embedded hosts, and CLI/MCP ensuring. Update migration examples, cancellation documentation and transport regressions. Part of #3759.
* Record Android foreground close fence observations

* Retain foreground probe failures in request diagnostics

* Place foreground evidence test at composition boundary

* Use Android package seams in routed evidence test

* Exercise request evidence at daemon boundary

* docs(android): explain foreground close failure evidence

* test: isolate interaction contract fixture claims

* test(contracts): reproduce inherited shared claim store
)

* feat(plugins): install managed local artifacts

* fix(plugins): bind artifact integrity and inventory to installed selections

* test(plugins): exercise managed artifact installation from the packed SDK

* fix(plugins): preserve host context and clarify artifact receipts

* test(plugins): correct list assertions and isolate host fixtures

* test(limrun): handle canceled fixture uploads

* refactor(plugins): keep one artifact version and clarify manager ownership

* fix(plugins): release artifact lock when staging cleanup fails

* test(plugins): verify lock release after cleanup failure

* refactor(plugins): unify selection transactions

* feat(plugins): accept local archives with add
* test(android): retain snapshot helper session diagnostics

* test(android): preserve verdict when recording snapshot evidence
* refactor(browserstack): extract BrowserStack into the @agent-device/browserstack plugin

Move the BrowserStack provider modules and tests out of provider-webdriver into
packages/provider-browserstack, packaged like the TestMu plugin (bundled ESM,
type-only agent-device/plugins, ./agent-device export, version 2 factory).
provider-webdriver keeps the shared engine and its ./plugin surface. Core no
longer registers BrowserStack; connect browserstack without the plugin fails
with the existing plugin-not-installed error naming plugins add
@agent-device/browserstack. The package stays private until its npm placeholder
and trusted publisher exist.

* docs(browserstack): move BrowserStack to the plugin install flow

Document plugins add @agent-device/browserstack in the BrowserStack, device
cloud and plugins guides, the README and the plugin package README, and add a
changeset.

* fix(browserstack): repair CI contracts and plugin review findings

* test(browserstack): repair packed export and HTTP fixture contracts

* fix(build): give shared bundler config a private workspace owner

* fix(build): complete typed workspace declarations for bundler policy

* chore(gates): declare build configuration as a leaf owner

* fix(build): classify Rolldown as a development dependency

* fix(browserstack): honor explicit credentials and shared contracts

* test(browserstack): cover empty credential overrides

* chore(browserstack): enable package publication
* refactor(test): colocate Maestro fuzz coverage with parser

* fix(host-kit): bound captured command output

* fix(host-kit): count raw output bytes before decoding

* refactor(host-kit): isolate command settlement classification

* fix(host-kit): preserve timeout and eager closure

* fix(test-kit): cover complete Maestro command tokens

* style(test): format Maestro coverage assertion

* fix(host-kit): retain bounded output on capture limit errors

* test: coordinate bounded output regression

* fix(host-kit): retry output-limit termination at deadline
* fix(plugins): admit connection providers from their host registry

* test(plugins): cover routed connection admission

* test(plugins): use explicit remote session fixtures

* test(plugins): verify routed admission and cleanup

* fix(connection): pass host environment through capability decisions

* test(connection): isolate stored status output assertions

* test(connection): register providers in lease fixtures

* test(connection): colocate provider lease fixture
* Extract AWS Device Farm provider plugin

* refactor(aws-device-farm): consolidate WebDriver imports

* test(aws-device-farm): colocate connection coverage

* Test packed AWS provider error boundary

* refactor(provider-webdriver): remove unused extraction scaffolding

* chore(gates): register the AWS packed smoke entry

* chore(gates): verify the explicit WebDriver plugin subpath

* test(layering): update WebDriver export boundary

* chore(gates): separate root dependency ownership from workspace references

* chore(gates): check workspace declarations in script test imports

* fix(plugins): defer host command execution imports

* refactor(webdriver): remove unused provider exports

* fix(plugins): preserve supplied command host context

* fix: address AWS plugin review findings

* fix(aws-device-farm): publish typed plugin entrypoints

* test(docs): resolve installed workspace plugins

* fix(ci): select moved snapshot differential test

* refactor(aws): import host capability types from the plugin SDK

* test(aws): cover routed plugin admission

* test(aws): register provider for stored lease fixtures

* chore(aws): enable package publication
* fix(plugins): name the release a channel plugin installs from

BrowserStack and AWS Device Farm publish only on the `nightly-0.22` tag, so their `latest` tag is
still the staged placeholder that exports no plugin. A missing-plugin error that named the bare
package therefore prescribed an install the manager refuses with `incompatible_plugin`, and help,
docs and the README still described AWS Device Farm as unpublished.

One catalog declaration records each plugin's channel. Recovery reads the running core's version
through the release grammar `scripts/release-version.mjs` owns: on a 0.22 nightly it names the
version built with this core, and everywhere else — a source checkout, a `main` nightly, a stable
release — it names the plain package as before. Printed guidance names the channel tag rather than a
build, so it holds across releases of one channel. No lookup, and no date or run in source.

Reason, package, provider and the restart hint are unchanged for every provider.

Co-authored-by: Apex <noreply@callstack.com>

* docs(release): name the plugin tag in the 0.22 changesets

The two pending 0.22 changesets become the shipped release notes for this extraction, and both
prescribed the bare package name — the selector that resolves to the placeholder — while the AWS one
still called the plugin unpublished. They now name the tag, and the exact version a missing-plugin
error prints for the release the reader runs.

Co-authored-by: Apex <noreply@callstack.com>

* fix(plugins): match provider help to the running release

* fix(help): type version-aware topic bodies

* docs(plugins): match shipped readmes to the release channel

* fix(plugins): repair provider selections with matching releases

* fix(plugins): match main-channel 0.22 nightly builds

* docs(plugins): clarify the 0.22 development channel default

* docs(website): describe AWS Device Farm as a provider plugin

* chore: remove changeset edits from the PR

* docs: use the 0.22 branch install instructions

---------

Co-authored-by: Apex <noreply@callstack.com>
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.07 MB 6.07 MB +750 B
Package (unpacked) 6.07 MB 6.07 MB +750 B
Package (download) 1.84 MB 1.84 MB +165 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 22.7 ms 21.6 ms -1.1 ms
CLI --help 46.1 ms 44.8 ms -1.3 ms

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

Review of 5321dff: the code needs changes before merge, mainly because both new facets grant more authority than the device scope the PR promises. CI is still running. No conflicts.

The Apple facet keeps stopRunnerSession and releaseRunnerOnClose with caller-supplied IDs (provider-plugin-host-capabilities.ts#L58). They reach the daemon's runner registry through runner-session.ts lines 702-755, and nothing checks lease ownership. A provider holding the facet can stop another session's local runner. Removing those two methods would still leave this authority. Please publish an allowlist for the three Apple operations Limrun borrows. Supply device-scoped operations through a binding that validates the owning lease before native work, and keep runner teardown with the lease and daemon ports that already own it.

The Android facet accepts an arbitrary serial, server selection or host command (L71). It goes through adb-host.ts to the root exec port without the managed admission in adb-transport.ts lines 542-555. The test at provider-plugin-host-capabilities.test.ts lines 72-78 expects a server-wide command to pass. A provider can address another session's device or stop shared ADB transport. runHostCommand already grants process execution, but this typed capability should still hold the device-scope rule. Please issue device execution from a validated lease or provider-owned transport. Keep tunnel connect and disconnect on the tunnel owner, with the endpoint derived from that owner.

The new structural invocation lets a plugin set command, target and rawArgv independently (host.ts#L46). The root guard checks invocation.command (L95-97), but the serializer in adb-transport.ts lines 348-356 and 623-638 gives rawArgv precedence. A mismatch can run a different command or target than the one checked. Please keep rawArgv private to the platform parser. Build provider invocations from one structured representation, and validate the command that is actually dispatched.

A retained Apple facet re-enters the command host only (L61). Runner lookups still use the caller's active runtime slot (runner-session.ts#L88, runtime-slots.ts#L24), and simulator operations still use the active AppleToolProvider (tool-provider.ts lines 187-219). A callback invoked outside a daemon or inside another embedded daemon can act on the wrong runtime or inherit another provider's transport. Please keep runner state behind the runtime that owns the lease, and pass the verified device and transport explicitly for shared Apple mechanics.

The Apple projection exposes applyRuntimeHints and clearRuntimeHints over the full DeviceInfo union (L58). They forward to runtime-hints.ts lines 50-74, which dispatches Android inputs to ADB. So even an Apple-only grant can write Android app preferences. Please have the Apple owner accept an admitted Apple target and use its Apple-only hint path.

The docs say a facet is present only when the host serves the family (plugins.md#L117). But provider-plugin-host-capabilities.ts lines 35-45 returns both after module imports, even without xcrun or an Android toolchain. An error while building Apple also drops Android through the registry's whole-bundle catch. A plugin that follows the documented check can enable an absent tool or lose a working Android facet. Please define availability. Either build only requested or supported facets and let each fail on its own, or document that presence means an adapter was supplied and tool readiness is a separate check.

The docs promise daemon-host scope for every facet operation (plugins.md#L117). The Android helpers at provider-plugin-host-capabilities.ts lines 97-124 call a supplied executor without entering runOnHost, including methods from createPortReverse. The bound methods also pass requestEnv: undefined, which keeps request overrides on the same host object (exec.ts lines 133-137). The daemon sets a request DEVELOPER_DIR (request-router.ts lines 224-226 and 513-515), so a host tool can pick a different toolchain. Please specify and enforce the scope for calls that run host tools. If callers own the scope of supplied executors, say so. Use an explicit request-env policy at the owning binding.

The Apple facet comment promises the captured host cwd (L40). The local simctl path (tool-provider.ts lines 77-85) calls runCmd without cwd, and exec.ts lines 221-223 takes cwd only from command options. An embedder can supply a cwd different from process.cwd (host.ts lines 12-29), so the tool starts in the parent directory. Relative tool inputs or PATH entries can then resolve in the wrong workspace. Please pass the captured cwd at the local Apple command adapter, or narrow the promise to what the adapter binds. A check with two different directories would prove it.

A facet construction rejection is caught at daemon startup before a diagnostic scope exists, and emitDiagnostic returns silently without one (registry.ts#L290, diagnostics.ts lines 176-178). The test creates its own scope at host-registry.test.ts#L141, which hides this. A daemon could lose both facets while other plugins register as active and nothing explains it. Could you confirm this? If it holds, use the daemon startup diagnostics owner or pass a startup sink into composition, and assert one visible startup event plus successful registration of unrelated plugins through that path.

The adbError body and its lazy-loading comment repeat the logic in limrun-runtime-dependencies.ts lines 99-109, which remains at lines 163-175 (L75). Both serialize the invocation and build the same typed error. Could you confirm this? If it holds, have both paths use one invocation-aware Android failure helper, or select one adapter at construction.

The stdin and binary stdout conversions at L133 repeat limrun-runtime-dependencies.ts lines 224-247. The new string-or-bytes API also sends strings through Buffer.from, although the transport accepts strings directly, so the code copies more than the stated policy of copying only foreign byte arrays. Could you confirm this? If it holds, own the byte contract once at the transport or adapter boundary, keep strings unchanged, and use one conversion in each direction.

The stdin test invents a runShell that injects bytes into forceStopApp (test#L113). The real adapter passes only allowFailure and signal, and forceStopApp has no production caller. Neither this test nor the mock at line 96 reaches provider-plugin-host-capabilities.ts lines 133-160, so removing the root conversions leaves the binary tests green. Please drive the real supplied facet with a plain and a sliced Uint8Array through the actual ADB executor seam. Assert bytes at the transport and on return, and cover a provider executor that yields a plain Uint8Array.

In sdk-host-public-types.test.ts (L146), assigning stdoutBuffer to Uint8Array also compiles if the declaration regresses to Buffer. The test loads Node types and resolves the checkout's compiled self-reference (lines 12-20 and 103-124). That proves neither the exact output type nor resolution from a packed install. Please assert type equality in both directions and run the fixture in the existing packed-package harness.

The built-in route now changes how a live lease reaches Apple lifecycle helpers and Android ADB (builtin-provider-plugins.ts#L55). The PR body says live validation is pending, and no commands or device outcomes are recorded. At 5321dff, please run the packaged core CLI or public client through normal daemon startup with built-in Limrun and an allocated or attached instance on each platform. On Android, record a lease-scoped app, keyboard, log or port-reverse operation and a binary operation such as a valid PNG capture. Show the registry-supplied runAdb path, and show cleanup of only that tunnel or mapping. On iOS, record open-target resolution and runtime hint apply and clear through the shared Apple tools inside the remote Limrun scope. Confirm runner-backed command success, then close the lease while a different runner stays live. Include daemon and device identity, commands and outputs. A local device run or a direct createLimrunRuntimeDependencies(host) run only proves a neighboring route.

Not blocking, take or leave: the public host adds a third declaration family for ADB execution, addressing, reverse mappings and keyboard state, and its inputOwner union duplicates AndroidInputOwner in contracts (host.ts#L18); the adapter checks for the Android facet on every forwarded call, keeps the parallel direct paths, and forwards runShell only for the unused forceStopApp (limrun-runtime-dependencies.ts#L64), while the package still needs the private createInteractor and downloadFile that the contract does not supply; the iOS test passes an Android device and a cast empty client to a stub that throws before any Apple operation, so it cannot catch a foreign lease or a local simulator (limrun-runtime-dependencies-host-capabilities.test.ts#L155); and the all-operations test would stay green if builtin-provider-plugins.ts#L55 dropped the facet argument, while the Limrun performance scenario at limrun-android-performance.test.ts#L44 starts with the fallback adapter, so one provider scenario through daemon composition asserting the leased device's remote ADB result would cover both.

Could 0.22 stay smaller? For example: use the existing setup host and add one narrow byte-capable Android transport for an admitted device or a Limrun-owned tunnel. Use runHostCommand for independent host commands. Keep reverse, app listing, logcat and keyboard on their existing executor-based owner or SDK exports. Choose the Limrun adapter once at setup. If Apple is needed for the extraction, expose the three concrete operations at the existing lease-scoped Apple binding, and avoid local runner management and raw ADB parser state. What would have to change first is a list of the calls the extracted package needs, including the issue's interactor and file operations, checked against the existing SDK and lease owners. Ownership must also be established before publication, and the superseded adapter branches deleted or merged. ADR 0019 and ADR 0034 already set the ownership and registry rules.

Next, reduce both grants to the operations and lease authority the provider needs. Then run the registry-to-daemon route on live Limrun iOS and Android, and wait for the four hosted checks, which are still running. None of the checks exercise the Limrun facets.

…ties

Remove the generic provider host-capability facet layer from #4720: the
 Limrun adapter already reaches adb, exec, ports, and files through its
 own lease-bound lazy edges, so the mirrored plugin-contract surface
 (ProviderHostCapabilities, rawArgv, capability resolver, startup
 diagnostics) added authority without behaviour.

Keep the two authority fixes at their owners:
- contracts expose AppleApplicationToolsForProvider as an explicit
  three-operation allowlist (resolveOpenTarget, applyRuntimeHints,
  clearRuntimeHints) and availableAppleApplicationToolsForProvider
  projects the runtime value through it, so leased remote runners and
  shutdown handles can no longer reach a provider;
- Apple application tools apply and clear runtime hints through the
  Apple-only path (applyAppleRuntimeHintValues /
  clearAppleRuntimeHintValues), which refuses non-Apple targets with
  apple_runtime_hint_target_required; neutral dispatchers are unchanged.

Restore host.ts, registry.ts, provider policy, builtin registrations,
SDK exports, layering zones, docs, and the host public-types test to
their pre-facet state.
@thymikee
thymikee added this pull request to stack #4731 November 19, 2026 08:55
thymikee added a commit that referenced this pull request Nov 19, 2026
…ials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.
@thymikee

Copy link
Copy Markdown
Member Author

Addressed the authority findings from the review of 5321dff5f4 in 81136d5df3. The generic provider facets are removed. Limrun uses the existing lease-scoped operations, and the iOS runner exposes only the three Apple application operations it needs. The Apple runtime rejects Android hint targets. The combined factory and connection changes are rebased in #4723.

Exact local validation passed on both heads (42 passed and 25 skipped each). Hosted CI and review are pending on the new heads. The packed registry-to-daemon Limrun iOS and Android receipts are still required before readiness.

@thymikee thymikee changed the title feat(plugins): scope provider host capabilities fix(limrun): scope iOS runner tools to lease operations Nov 19, 2026
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 81136d5

Since the review of 5321dff: 0 new · 0 still open · 0 no longer raised

No open findings.

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (c3a3316a5893).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks for the update. At 81136d5, the code that the earlier review (#4720 (comment)) flagged is gone, and the Android hint path is fixed because hints now run only on the Apple path. The Android evidence is no longer needed, because no Android code changes. One item remains: the live iOS evidence.

The PR still changes two device-facing paths: how the Limrun iOS runner builds its host Apple tools (limrun-ios-runner.ts:53), and which hint function the shared Apple tools run for open and close (runtime-hints.ts:78). The only proof is a fixture with mocked xcrun and a mocked Limrun HTTP endpoint. Those tests do not show that hint writes still run inside the Limrun Apple tool provider scope on a real lease. If the scope is broken, defaults would be written through local xcrun or fail. Please start the packed CLI through normal daemon startup with built-in Limrun and an allocated or attached iOS instance. Run open <bundle> with --metro-host and --metro-port, and show RCT_jsLocation set on that instance. Then run a runner-backed snapshot that reports backend xctest. Then close or clear the hints and show the default deleted. Please include the daemon version, the lease and device identity, the commands and the outputs. A local simulator run only proves a neighboring route.

Not blocking, and you can take or leave these: applyAppleRuntimeHintValues and clearAppleRuntimeHintValues repeat the non-Android tail of applyRuntimeHintValues and clearRuntimeHintValues, so one Apple branch would do; the hostTools parameter in limrun-ios-application-tools.ts:29 Picks every member of a type that has only those three; and the getter test in limrun-ios-runner.test.ts:52 fails at base only because of a property read, not an observable failure, while the helper named fail only records calls.

Could this be smaller? Neither the projection nor the hint refusal can be reached on a production route today. At base no provider receives createAppleApplicationTools, the runner already called only those three members, and no Android device reaches the Apple tools. In createRunner in limrun-runtime-dependencies.ts, you could pass { resolveOpenTarget, applyRuntimeHints, clearRuntimeHints } from createAppleApplicationTools(host.env). You could type the runner parameter with the existing Pick<AppleApplicationTools, …>. That adds no contracts type and no projection function. If #4723 needs the projection across the plugin boundary, it belongs at the plugin host contract that the extracted package consumes (ADR 0034), not in the private contracts package. Does #4723 or the extracted @agent-device/limrun package receive Apple tools from the host? If not, is this PR still needed for #3311, or can it close into #4723?

CI shows 14 checks with 0 failing at 81136d5. No CI job reaches a live Limrun lease, so CI does not cover the route above. Before merge, please post the live Limrun iOS evidence for hint apply and clear plus the XCTest snapshot, and settle where the projection belongs.

@thymikee

Copy link
Copy Markdown
Member Author

Answer to the design question: no. Neither #4723 nor the extracted @agent-device/limrun package receives Apple tools from the host. The package reads session.runner.applicationTools (packages/provider-limrun/src/ios.ts), and core builds that runner from createAppleApplicationTools(host.env) in createRunner (src/sdk/limrun-runtime-dependencies.ts:132). #4723's diff does not touch any file this PR changes, and it does not use the projection or the Apple hint functions. This PR is not needed for #3311.

Plan:

  • Close this PR into refactor(limrun): compose the v2 plugin factory #4723. The projection, the contracts type and the Apple-only hint functions are dropped, because no production route reaches them.
  • refactor(limrun): compose the v2 plugin factory #4723 is restacked directly on the refreshed 0.22. It gets one type-only commit: createRunner passes { resolveOpenTarget, applyRuntimeHints, clearRuntimeHints } from createAppleApplicationTools(host.env), and createLimrunIosRunner takes Pick<AppleApplicationTools, 'resolveOpenTarget' | 'applyRuntimeHints' | 'clearRuntimeHints'>. The runner already called only those three members, so its behavior does not change.
  • The hint function and the runner's tool scope stay as they are at base. This removes the two device-facing changes that the live iOS evidence was for. Live provider acceptance for the stack stays tracked on refactor(limrun): compose the v2 plugin factory #4723.

The 0.22 rebase onto main is in progress. I will close this PR after #4723 is pushed and retargeted to 0.22.

thymikee added a commit that referenced this pull request Nov 19, 2026
…ials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.
@thymikee
thymikee removed this pull request from stack #4731 November 19, 2026 14:22
@thymikee

Copy link
Copy Markdown
Member Author

Closed into #4723, as answered in #4720 (comment). The extracted package does not take Apple tools from the host, so the projection, the contracts type and the Apple-only hint functions are dropped. #4723 now targets 0.22 directly and carries the one type-only change: createLimrunIosRunner takes Pick<AppleApplicationTools, 'resolveOpenTarget' | 'applyRuntimeHints' | 'clearRuntimeHints'>.

@thymikee thymikee closed this Nov 19, 2026
@thymikee
thymikee deleted the refactor/0.22-limrun-provider-host branch November 19, 2026 14:23
thymikee added a commit that referenced this pull request Nov 19, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
thymikee added a commit that referenced this pull request Nov 19, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
thymikee added a commit that referenced this pull request Nov 20, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
thymikee added a commit that referenced this pull request Nov 20, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
thymikee added a commit that referenced this pull request Nov 21, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
thymikee added a commit that referenced this pull request Nov 23, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
hannojg pushed a commit to hannojg/agent-device that referenced this pull request Nov 23, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue callstack#3311. Builds on callstack#4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
thymikee added a commit that referenced this pull request Nov 24, 2026
* refactor(limrun): add transitional v2 plugin factory and move credentials to the provider package

Issue #3311. Builds on #4720 (provider-plugin host).

- Add packages/provider-limrun/src/plugin.ts: the single transitional
  limrunPlugin(options) factory. Its setup reads credentials, builds
  runtime dependencies through the injected plugin host, and loads the
  runtime with the platform module; its credentials declaration keeps
  per-backend fingerprint narrowing.
- Move the credential reader and declaration from
  src/provider-limrun-credentials.ts to
  packages/provider-limrun/src/credentials.ts so the provider package
  owns credential interpretation.
- Expose the factory through the new lazy, SDK-free
  @agent-device/provider-limrun/internal entry; the built-in candidate
  in src/builtin-provider-plugins.ts composes the factory with the
  root-owned runtime dependencies and state paths, preserving
  dormant/failed/active candidate semantics.
- Rewire src/cli/connection and the daemon credential test to the
  internal entry; drop the migrated root-module-zone row; update the
  boundary and dependency pins, package manifests, and lockfile.

* test(limrun): read credential names from plugin inventory

* style(limrun): format the reconciled factory call

* refactor(limrun): route the built-in connect through the provider's own v2 connection callbacks

Move the connect decisions into one provider-owned set of callbacks: the connect-flag
refusals (including --device), the per-platform credential narrowing, the connection
capabilities, and the verification read-only check now live in the provider package's
connection module, which the plugin declares lazily. The CLI composition drops its
hand-written Limrun adapter and runs the same callbacks through the plugin shape, wired
to the host the way the daemon's registry wires an installed plugin's, so both answers
come from the provider. The profile fields the host owns stay with the host: tenant,
session, run identity, state dir, and Metro settings.

* fix(limrun): retain saved named-session identity

* refactor(limrun): keep the connection's verification inside the provider

The built-in `connect` composed its provider's callbacks through the provider package's root entry
just to inject that provider's own read-only check, which evaluated the runtime the composition was
meant to keep lazy, and let a caller replace a verification it does not own. The connection now
loads the provider's own verification in the `verify` path alone, so the built-in and an installed
plugin answer with the same entry and nothing above the connection decides what it verifies through;
the plugin option, the verifier type, and the root's verification export go with it. The suites read
the Limrun SDK boundary instead of the provider package, so they assert what the account or the
attached instance is asked for: the scoped credentials, the host's version, and the selected
platform, with no runtime set up on `connect`.

* refactor(limrun): pass only the three Apple tools the iOS runner uses

* refactor(limrun): declare the plugin's connection in its return type

limrunPlugin always declares a connection, so its type says so and the built-in connection no longer checks for a missing one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants